import type { IColumnsOption } from 'vc';
import { INDEX, COMPANY_NAME, INFO_SOURCE, PROVINCE, CITY, COUNTRY, INDUSTRY_CATEGORY, BUSINESS_DATA, REGISTERED_CAPITAL } from '@/utils';

export function useTable() {
  const tableData = ref([]);

  const columns = ref<IColumnsOption[]>([
    { ...INDEX },
    { ...COMPANY_NAME },
    {
      title: '评价年度',
      field: 'tagYear',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'tagYear'
    },
    {
      title: '披露日期',
      field: 'noticeDate',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'noticeDate'
    },
    {
      title: '认定单位',
      field: 'postAgency',
      width: 200,
      align: 'center'
    },
    {
      title: '列入日期',
      field: 'startDate',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'startDate'
    },
    {
      title: '移除日期',
      field: 'expirationDate',
      width: 100,
      align: 'center',
      sortable: true,
      sortBy: 'expirationDate'
    },
    { ...INFO_SOURCE('tagName') },
    { ...PROVINCE },
    { ...CITY },
    { ...COUNTRY },
    { ...INDUSTRY_CATEGORY },
    { ...BUSINESS_DATA },
    { ...REGISTERED_CAPITAL }
  ]);

  return {
    tableData,
    columns
  };
}
